package chapter6;
import java.util.Scanner;
/****************************************************************
 * Author：icynlau
 * Description: 摄氏度 华氏度
 * Date:2021/4/4
运行结果：
摄氏度	华氏度			华氏度	摄氏度
===============================
40.0    	104.0   		      120.0	      48.89 
39.0    	102.2   		      110.0	      43.33 
38.0    	100.4   		      100.0	      37.78 
37.0    	98.6    		       90.0	      32.22 
36.0    	96.8    		       80.0	      26.67 
35.0    	95.0    		       70.0	      21.11 
34.0    	93.2    		       60.0	      15.56 
33.0    	91.4    		       50.0	      10.00 
32.0    	89.6    		       40.0	       4.44 
31.0    	87.8    		       30.0	      -1.11 
 * ***************************************************************
 */
public class exc6_8 {
	
	public static double celsius2Fahrenheit(double celsius) {
		
		return ((9.0/5.0)*celsius+32);
		
	}
	
	public static double fahrenheit2Celsius(double fahrenheit) {
		
		return ((5.0/9.0)*(fahrenheit-32));
		
	}
	
	public static void main(String[] args) {
		
		System.out.print("摄氏度\t华氏度\t\t\t华氏度\t摄氏度\n");
		System.out.print("===============================\n");
		//一共打印10行
		for(int i=0;i<10;i++) {
			
			System.out.printf("%-8.1f\t%-8.1f\t\t   %8.1f\t   %8.2f \n", 
					40.0-i,celsius2Fahrenheit(40.0-i),120.0-10.0*i,fahrenheit2Celsius(120.0-10.0*i));
			
		}
		
	}

}
